import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

class HandshakeCalculator {

    List<Signal> calculateHandshake(int number) {
        List<Signal> signal = new ArrayList<>();

        if ((number & 1) == 1) {
            signal.add(Signal.WINK);
        }
        if ((number & 2) == 2) {
            signal.add(Signal.DOUBLE_BLINK);
        }
        if ((number & 4) == 4) {
            signal.add(Signal.CLOSE_YOUR_EYES);
        }
        if ((number & 8) == 8) {
            signal.add(Signal.JUMP);
        }

        if(number > 16){
            Comparator<Signal> comparator = new Comparator<Signal>() {
                @Override
                public int compare(Signal o1, Signal o2) {
                    return o2.compareTo(o1);
                }
            };
            signal.sort(comparator);
        }

        return signal;
    }

}
